package com.pm2.dao.plan;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.pm2.entity.plan.DayPlan;

public interface DayPlanDao extends JpaRepository<DayPlan, Long> {
	
	@Query("from DayPlan where project_id= ?1")
	public List<DayPlan> findByProjectId(int project_id);
	
	/** 
	* @Description: 根据主计划的编号查询工作天数 
	* @Title: findByPid 
	* @param pid
	* @return List<DayPlan>
	* @author qin
	* @date 2018年7月18日下午2:25:03
	*/ 
	@Query("from DayPlan where pid= ?1")
	public List<DayPlan> findByPid(int pid);
	
	
	@Modifying
	@Transactional
	@Query("delete DayPlan where pid= ?1")
	int deleteByPid(int pid);
}
